package com.yougou.data.model;

import java.io.Serializable;

public class CartItem implements Serializable {
    private static final long serialVersionUID = 1L;
    private int id;
    private Goods goods;
    private int quantity;
    private boolean isChecked;
    
    public CartItem() {
    }
    
    public CartItem(Goods goods, int quantity) {
        this.goods = goods;
        this.quantity = quantity;
        this.isChecked = true;
    }
    
    public int getId() {
        return id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public Goods getGoods() {
        return goods;
    }
    
    public void setGoods(Goods goods) {
        this.goods = goods;
    }
    
    public int getQuantity() {
        return quantity;
    }
    
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
    
    public boolean isChecked() {
        return isChecked;
    }
    
    public void setChecked(boolean checked) {
        isChecked = checked;
    }
    
    
    public double getSubtotal() {
        if (goods != null) {
            return goods.getGoodsPrice() * quantity;
        }
        return 0;
    }
}

